package so.sao.code.service.web.api;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import so.sao.code.dto.request.CodeFileCreate;
import so.sao.code.service.service.CodeFileHandleService;

@Api(tags = "codefilehandle", value = "对存储code对应的url云文件维护处理")
@RestController
@RequestMapping("/api/codefilehandle")
public class CodeFileHandleFeignController {

	@Autowired
	private CodeFileHandleService codeFileHandleService;

	/*@ApiOperation(value = "码url文件路径推送", notes = "根据推送参数信息获取拉取云上文件,解析内码(外码),箱码,辅料箱码获取标签数据,更新标签家族")
	@ApiImplicitParam(name = "fileParam", value = "参数信息(容器名称,文件路径,文件类型)", required = true, dataType = "CodeFileCreate", paramType = "body")*/
	@PostMapping(value = "/pushCodeFilePath", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
	public ResponseEntity<String> pushCodeFilePath(@Valid @RequestBody CodeFileCreate fileParam) {
		codeFileHandleService.handleCodeFileParam(fileParam);
		return new ResponseEntity<>(HttpStatus.OK);
	}

}
